﻿using System;
using System.Collections.Generic;
using System.Text;
using TSVNAddin.TSVN;
using EnvDTE;
using EnvDTE80;

namespace TSVNAddin.Core
{
	public class TortoisePathCommand : ICommand
	{
		private readonly TortoiseProcExecutor _TortoiseProcExecutor;
		private readonly IPathCommandContext _CommandContext;
		private TortoiseProcCommandType _TortoiseCommandType;
		private TortoiseProcArgumentType[] _TortoiseArguments;

		public TortoisePathCommand(TortoiseProcExecutor tortoiseProcExecutor, IPathCommandContext commandContext, TortoiseProcCommandType tortoiseCommandType, params TortoiseProcArgumentType[] tortoiseArguments)
		{
			_TortoiseProcExecutor = tortoiseProcExecutor;
			_CommandContext = commandContext;
			_TortoiseCommandType = tortoiseCommandType;
			_TortoiseArguments = tortoiseArguments;
		}

		public void Execute()
		{
			string workingRoot = _CommandContext.GetWorkingPath();
			_TortoiseProcExecutor.Exec(_TortoiseCommandType, workingRoot, _TortoiseArguments);
		}

		public CommandStatus QueryStatus()
		{
			return _CommandContext.GetCommandStatus();
		}
	}
}
